package mobilizator.app;

import java.util.ArrayList;

import mobilizator.app.data.Category;
import mobilizator.app.db.MobilizatorDb;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import mobilizator.app.R;

public class Mobilizator163Activity extends Activity implements OnClickListener {
	
	private TextView title;
	
    private ImageView createBtn, addClothBtn, advicesBtn, clothListBtn,
	    favoritesBtn, settingsBtn;

    private Context context = this;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main_screen);
	
	title = (TextView) findViewById(R.id.header_title);
	title.setText("Menu główne");

	createBtn = (ImageView) findViewById(R.id.ms_image1);
	createBtn.setOnClickListener(this);

	addClothBtn = (ImageView) findViewById(R.id.ms_image2);
	addClothBtn.setOnClickListener(this);

	clothListBtn = (ImageView) findViewById(R.id.ms_image3);
	clothListBtn.setOnClickListener(this);

	favoritesBtn = (ImageView) findViewById(R.id.ms_image4);
	favoritesBtn.setOnClickListener(this);

	advicesBtn = (ImageView) findViewById(R.id.ms_image5);
	advicesBtn.setOnClickListener(this);
	
	settingsBtn = (ImageView) findViewById(R.id.ms_image6);
	settingsBtn.setOnClickListener(this);
	
	MobilizatorDb mdb = new MobilizatorDb(this);
	ArrayList<Category> cat = mdb.getMainCategories();
	Log.d("bla", "bla");
	// MobilizatorDb mdb = new MobilizatorDb(this);
	// mdb.getMainCategories();

    }

    public void onClick(View v) {
	int id = v.getId();

	switch (id) {
	case R.id.ms_image1:
	    startIntent(mobilizator.app.creations.CreateCreationActivity.class);
	    break;
	case R.id.ms_image2:
	    startIntent(mobilizator.app.add.AddClothActivity.class);
	    break;
	case R.id.ms_image5:
	    startIntent(mobilizator.app.advices.AdvicesActivity.class);
	    break;
	case R.id.ms_image3:
	    startIntent(mobilizator.app.list.ClothListCategoriesActivity.class);
	    break;
	case R.id.ms_image4:
	    startIntent(mobilizator.app.favorites.FavoritesActivity.class);
	    break;
	case R.id.ms_image6:
		startIntent(mobilizator.app.settings.SettingsActivity.class);
	    break;
	default:
	    break;
	}

    }

    private void startIntent(Class<?> cls) {
	Intent intent = new Intent(context, cls);
	startActivity(intent);

    }
}